package com.hxh.component.basicore.component.mvp.view;

import com.hxh.component.basicore.component.mvp.EmptyFragment;
import com.hxh.component.basicore.component.mvp.persenter.IPresenter;
import com.hxh.component.basicore.ui.loading.LoadingDialog;

/**
 * 对外提供各种操作方法，内部统一交由对应的Delegate实现
 */
public abstract class BaseLazyFragment<P extends IPresenter>
        extends EmptyFragment<P>
        implements IView<P> {

    private LoadingDialog mLoadingDialog;

    public void showLoadingDialog(String msg) {
        if (null == mLoadingDialog) {
            mLoadingDialog = new LoadingDialog(getActivity(), msg);
        }
        mLoadingDialog.show();
    }

    public void setLoadingDialogMsg(String msg) {
        if (null == mLoadingDialog) {
            mLoadingDialog = new LoadingDialog(getActivity(), msg);
        }
        mLoadingDialog.setText(msg);
    }

    public void dismissLoadingDialog() {
        if (null != mLoadingDialog) {
            mLoadingDialog.close();
        }
    }
}
